import request from '@/utils/request'
// 设备列表
export function getList(params) {
  return request({
    url: '/vm-service/vm/search',
    method: 'GET',
    params
  })
}
// 策略列表
export function getpolicy() {
  return request({
    url: '/vm-service/policy',
    method: 'GET'
  })
}
// 新增
export function add(data) {
  return request({
    url: '/vm-service/vm',
    method: 'POST',
    data
  })
}
// 售货机类型
export function vmTypeList(params) {
  return request({
    url: '/vm-service/vmType/search',
    method: 'GET',
    params
  })
}
// 策略
export function vmPolicy(innerCode) {
  return request({
    url: '/vm-service/policy/vmPolicy/' + innerCode,
    method: 'GET'
  })
}
// 取消策略
export function removePolicy(innerCode, policyId) {
  return request({
    url: `/vm-service/vm/cancelPolicy/${innerCode}/${policyId}`,
    method: 'PUT'
  })
}
// 修改策略
export function updatePolicy(data) {
  return request({
    url: '/vm-service/vm/applyPolicy',
    method: 'PUT',
    data
  })
}
// 修改点位
export function updatepoint(id, nodeId) {
  return request({
    url: `/vm-service/vm/${id}/${nodeId}`,
    method: 'PUT'
  })
}

// 货道详情
export function getCargoList(innerCode) {
  return request({
    url: '/vm-service/channel/channelList/' + innerCode,
    method: 'GET'
  })
}
// 商品搜索
export function searchGoods(params) {
  return request({
    url: '/vm-service/sku/search',
    method: 'GET',
    params
  })
}

// 删除商品
export function delGoods(classId) {
  return request({
    url: '/vm-service/skuClass/' + classId,
    method: 'DELETE'
  })
}
// 商圈
export function getBusinessType(id) {
  return request({
    url: 'vm-service/businessType/name/' + id,
    method: 'GET'
  })
}
// 前十商品
export function topGoods(businessId) {
  return request({
    url: '/vm-service/sku/businessTop10/' + businessId,
    method: 'GET'
  })
}
// 修改商品
export function updateGoods(data) {
  return request({
    url: '/vm-service/channel/channelConfig',
    method: 'PUT',
    data
  })
}
